<template>
  <div>
    <div class="my_div" @click="$emit('addLiek', obj.dogName)">
      <img
        src="https://scpic.chinaz.net/files/pic/pic9/202003/zzpic23514.jpg"
        alt=""
      />
      <p @click.stop="changeColor" :style="{ background: myColor }">
        {{ obj.dogName }}
      </p>
    </div>
  </div>
</template>

<script>
export default {
  name: "LianXi",
  components: {},
  props: {
    obj: {
      type: Object,
      require: true,
    },
  },
  data() {
    return {
      myColor: "",
    };
  },
  computed: {},
  watch: {},
  created() {},
  methods: {
    changeColor() {
      this.myColor = `rgba(${Math.floor(Math.random() * 256)},${Math.floor(
        Math.random() * 256
      )},${Math.floor(Math.random() * 256)})`;
    },
  },
};
</script>

<style scoped>
.my_div {
  width: 200px;
  border: 1px solid black;
  text-align: center;
  float: left;
}

.my_div img {
  width: 100%;
  height: 200px;
}
</style>
